var e = {}, 
  platform_url = "https://en.zcchengyi.com/ckapi",
  // platform_url = "http://192.168.0.162:7777/api",
  // platform_url = "http://127.0.0.1:7777/api",
  webSocketUrl = "ws://en.zcchengyi.com:7778/websocket/", 
  imgURL = 'https://en.zcchengyi.com/checkimg/simple',
  app = getApp();

e.httpPost = function (url,param, sucess_fun, fail_fun) {
  url = platform_url + url;
  var userid = getApp().getStorageSync('user_id');
  if (userid == undefined || userid == '' || userid == null ){
    userid = getApp().globalData.userid;
  }
  
  param["user_id"] = userid; 

  // let user_id = 860// 作业票申请  
  // let user_id = 10156// 焊工
  // let user_id = 10381// 安全员
  // let user_id = 12100// 最后审核人  
  // param["user_id"] = user_id; 
  // getApp().setStorageSync('user_id', user_id);  

  param["platform"] = "cy";//琤一智能

  wx.request({
    url: url,
    data: param,
    method: 'POST',
    header: { "Content-Type": "application/json;charset=UTF-8"},
    success: function (t) {
      200 == t.statusCode ? sucess_fun(t) : fail_fun(t);
    },fail: function (t) { fail_fun(t); }
  });
},

e.getPlatformUrl=function(){
  return platform_url;
}
e.getImgUrl=function(){
  return imgURL;
}
 module.exports = e;
